//
//  WJPublishModel.m
//  WJBSApp
//
//  Created by dllo on 16/7/31.
//  Copyright © 2016年 王景伟. All rights reserved.
//

#import "WJPublishModel.h"

@implementation WJPublishModel




- (CGFloat)cellHeight
{
     if (!_cellHeight) {
         
         NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:14]};
         CGRect rect = [self.text boundingRectWithSize:CGSizeMake(WIDTH - 20, 10000) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
   
         _cellHeight = 50 + rect.size.height;
         
         
         if ([self.type isEqualToString:@"links"] || [self.type isEqualToString:@"audio"]) {
             
             _cellHeight = _cellHeight + 70;
             
         }
         
         if ([self.type isEqualToString:@"pic"] || [self.type isEqualToString:@"video"] ) {
             
             UIImage *image = [UIImage imageWithData:self.picData];
             
             CGFloat height = (WIDTH - 20) * image.size.height / image.size.width;

             _cellHeight = _cellHeight + 50 + height;
             
         }
         
         
     }
    return _cellHeight;
}







@end
